Skip to content

Conversation

@olaservo
Copy link
Member

@olaservo olaservo commented Jan 19, 2026

Summary

Reference implementation of @modelcontextprotocol/inspector-core - a reusable core package for MCP client logic with no React dependencies.

Specification References

This implementation follows the V2 specification documents in specification/:

Spec Implementation
v2_scope.md Package architecture enabling CLI/TUI/Web sharing
v2_ux_handlers.md Handler interfaces for sampling, elicitation
v2_tech_stack.md TypeScript, MCP SDK integration

Related: Issue #983 (data spec discussion)

Directory Structure

core/
├── src/
│   ├── client.ts         # MCP client lifecycle (create, connect, disconnect)
│   ├── transport.ts      # StreamableHTTPClientTransport factory
│   ├── handlers.ts       # Sampling/elicitation handler creation
│   ├── index.ts          # Public API exports
│   ├── data/
│   │   ├── repositories.ts  # CRUD interfaces (proxy API contracts)
│   │   └── index.ts
│   └── types/
│       ├── auth.ts          # OAuth state types
│       ├── capabilities.ts  # Server capabilities
│       ├── clientRequests.ts # Sampling/elicitation request types
│       ├── history.ts       # History entries with parent-child relationships
│       ├── logs.ts          # RFC 5424 log levels
│       ├── responses.ts     # MCP response types
│       ├── servers.ts       # Server config types
│       ├── tasks.ts         # Task management types
│       ├── testingProfiles.ts # Auto-respond configuration
│       └── index.ts
├── test-core.js          # Unit tests (12 tests)
└── test-real-server.js   # Integration tests with Everything MCP server (13 tests)

Core Features

  • MCP client lifecycle: createMcpClient, connectClient, disconnectClient, isClientConnected
  • Transport factory: createHttpTransport for Streamable HTTP connections
  • Handler creation: createSamplingHandler, createElicitationHandler with queue-based patterns
  • Repository interfaces: ServerConfigRepository, HistoryRepository, LogsRepository, TestingProfileRepository (proxy API contracts)
  • Type definitions: History entries with parent-child relationships, RFC 5424 log levels, testing profiles

Design Principles

  1. No React dependencies - Can be used in CLI, TUI, or test frameworks
  2. Interface-first data layer - Repository interfaces define proxy API contracts
  3. UI-specific state management - Connection/execution state managed by UI patterns (React Context) per v2_storage.md

Note: Memory stub implementations and service interfaces were removed (2026-01-21) as unused code. Repository interfaces remain as contracts for future proxy API implementations. See architecture-recommendations.md for rationale.

Test Plan

  • Unit tests pass: node core/test-core.js (12 tests)
  • Integration tests pass: node core/test-real-server.js (13 tests)
  • Review feedback incorporated

Stack


Generated with Claude Code

olaservo and others added 2 commits January 18, 2026 12:44
Extracts reusable MCP client logic into a separate package that can be
shared across web UI, CLI, and TUI implementations.

Includes:
- MCP client lifecycle (createMcpClient, connectClient, disconnectClient)
- HTTP transport creation (createHttpTransport, createAuthenticatedTransport)
- Sampling/elicitation request handlers
- Data layer interfaces (repositories, services) with memory stubs
- Shared type definitions
- test-core.js: Unit tests for memory implementations (repositories,
  services, type helpers)
- test-real-server.js: Integration tests with Everything MCP server

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants